//
//  OneViewController.m
//  RAC
//
//  Created by 宜必鑫科技 on 2017/10/27.
//  Copyright © 2017年 宜必鑫科技. All rights reserved.
//

#import "OneViewController.h"

@interface OneViewController ()
@property (nonatomic, strong) UIButton *oneBut;
@end

@implementation OneViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.delegateSubject = [RACReplaySubject subject];
   
    _oneBut = [[UIButton alloc]initWithFrame:CGRectMake(10, 230, ScreenWidth - 20, 50)];
    _oneBut.backgroundColor = [UIColor lightGrayColor];
    [_oneBut setTitle:@"后往前传值" forState:UIControlStateNormal];
    [self.view addSubview:_oneBut];
    [[_oneBut rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [self.delegateSubject sendNext:@"2323"];
        [self dismissViewControllerAnimated:YES completion:nil];
    }];
}

- (void)Click
{
    if (self.delegateSubject) {
        [self.delegateSubject sendNext:@"往前"];
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
